<template>
  <div id="index">
    <dv-full-screen-container class="bg">
      <dv-loading v-if="loading">Loading...</dv-loading>
      <div v-else class="host-body">
        <!-- 第一行 -->
        <div class="d-flex jc-center">
          <dv-decoration-10 style="width:33.3%;height:.0625rem;" />
          <div class="d-flex jc-center">
            <dv-decoration-8 :color="['#568aea', '#000000']" style="width:2.5rem;height:.625rem;" />
            <div class="title">
              <span class="title-text">大数据可视化平台</span>
              <dv-decoration-6
                class="title-bototm"
                :reverse="true"
                :color="['#50e3c2', '#67a1e5']"
                style="width:3.125rem;height:.1rem;"
              />
            </div>
            <dv-decoration-8
              :reverse="true"
              :color="['#568aea', '#000000']"
              style="width:2.5rem;height:.625rem;"
            />
          </div>
          <dv-decoration-10 style="width:33.3%;height:.0625rem; transform: rotateY(180deg);" />
        </div>
        <!-- 第二行 -->
        <div class="d-flex jc-between px-2">
          <div class="d-flex" style="width: 40%">
            <div class="react-right bg-color-blue mr-4">
              <!-- <span class="react-before"></span> -->
              <span class="text fw-b" @click="turnPageCar()">道路机扫</span>
            </div>
            <!-- <div class="react-right bg-color-blue mr-4">
              <span class="text fw-b" @click="turnPageCarCity()">市级机扫水洗</span>
            </div> -->
            <div class="react-right bg-color-blue-after mr-4">
              <span class="text fw-b" @click="turnPageGarbage()">垃圾收运</span>
            </div>
            <!-- <div class="react-right bg-color-blue mr-4">
              <span class="text fw-b" @click="turnPageKitchen()">餐厨垃圾</span>
            </div> -->
            <div class="react-right bg-color-blue mr-4">
              <span class="text fw-b" @click="turnPageWorker()">人工保洁</span>
            </div>
            
          </div>
          <div class="d-flex" style="width: 40%">
            
            <div class="react-left bg-color-blue mr-4">
              <span class="text fw-b" @click="turnPageWC()">公厕维护</span>
            </div>
            <div class="react-left bg-color-blue mr-4">
              <span class="text fw-b" @click="turnPageServiceCar()">车务机务</span>
            </div>
            <!-- <div class="react-left bg-color-blue mr-4">
              <span class="text fw-b" @click="turnPageGarbageCompany()">工业垃圾</span>
            </div> -->
            <!-- <div class="react-left bg-color-blue mr-4">
              <span class="text fw-b" @click="turnPageGarbageLJSB()">垃圾上报</span>
            </div> -->
            <!-- <div
              class="react-left bg-color-blue mr-4"
              style="width: 6.25rem; background-color: #0f1325; text-align: right;"
            >
              <span class="react-after"></span>
              <span class="text">{{dateYear}} {{dateWeek}} {{dateDay}}</span>
            </div> -->
          </div>
        </div>
        <div class="body-box">
          <iframe class="mainFrame" :src="a" frameborder="0"></iframe>
        </div>
      </div>
    </dv-full-screen-container>
  </div>
</template>

<script>
import { formatTime } from '../utils/index.js'
export default {
  data () {
    return {
      datePara: '',
      loading: true,
      dateDay: null,
      dateYear: null,
      dateWeek: null,
      weekday: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
      a: ''
    };
  },
  mounted () {
    this.initFrame()
    this.timeFn();
    this.cancelLoading();
  },
  methods: {
    initFrame () {
      this.datePara = this.$route.query.date
      if (!this.datePara){
        this.datePara = this.$route.params.date
      }
      if (!this.datePara){
        this.datePara = formatTime(new Date(), 'yyyy-MM')
      }
      this.a = 'http://111.160.78.62:9936/bde_indexGarbage.html?user=dlhw&ClientNo=0000009&date=' + this.datePara
      // this.a = `http://111.160.78.62:9936/linkGarbageCity.html?user=${this.$route.query.user}&date=${this.$route.query.date}&ClientNo=${this.$route.query.ClientNo}`
      // document.getElementById('mainFrame').src = url
      // }, 100)
    }, turnPageKitchen () {
      // event.stopPropagation();
      this.$router.push({ name: 'linkKitchen', params: { date: this.datePara } })
    }, turnPageWC () {
      // event.stopPropagation();
      this.$router.push({ name: 'linkWC', params: { date: this.datePara } })
    }, turnPageCar () {
      // event.stopPropagation();
      this.$router.push({ name: 'linkCar', params: { date: this.datePara } })
    }, turnPageWorker () {
      // event.stopPropagation();
      this.$router.push({ name: 'linkWorker', params: { date: this.datePara } })
    }, turnPageGarbage () {
      // event.stopPropagation();
      this.$router.push({ name: 'linkGarbage', params: { date: this.datePara } })
    }, turnPageGarbageCompany () {
      // event.stopPropagation();
      this.$router.push({ name: 'linkGarbageCompany', params: { date: this.datePara } })
    }, turnPageCarCity () {
      // event.stopPropagation();
      this.$router.push({ name: 'linkCarCity', params: { date: this.datePara } })
    }, turnPageGarbageLJSB () {
      this.$router.push({ name: 'linkGarbageLJSB', params: { date: this.datePara } })
    },turnPageServiceCar () {
      this.$router.push({ name: 'linkServiceCar', params: { date: this.datePara } })
    },
    timeFn () {
      setInterval(() => {
        this.dateDay = formatTime(new Date(), 'HH: mm: ss');
        this.dateYear = formatTime(new Date(), 'yyyy-MM-dd');
        this.dateWeek = this.weekday[new Date().getDay()];
      }, 1000)
    },
    cancelLoading () {
      setTimeout(() => {
        this.loading = false;
      }, 500);
    }
  }
};
</script>

<style lang="scss">
@import '../assets/scss/index.scss';
.mainFrame {
  // height: 100%;
  height:calc(100% - 132px);
  width: 100%;
}
</style>